var express = require('express');
var router = express.Router();

var controllers = require('../controllers/wenzhang');


router.get('/', function(req, res, next) {
    controllers.bigfenlei(req, res, next)
});


router.get('/userList/:id', function(req, res, next) {
    controllers.userList(req, res, next)
});

router.get('/article/:id', function(req, res, next) {
   controllers.Article(req, res, next);
});
router.get('/all/:id/:page', function(req, res, next) {
   controllers.index(req, res, next);
});


router.route('/login').get(function(req, res, next) {
    res.render('login', { title: '用户登录' });
}).post(function(req,res){
	var user={
		username:'admin',
		password:'123456'
	};
	if(req.body.username===user.username&&req.body.password===user.password){
		res.redirect('/index');
	}
	res.redirect('/login');
});




module.exports = router;
